package org.warehouse.dao;

import java.util.List;

import org.warehouse.entity.Group;
import org.warehouse.entity.Product;
import org.warehouse.util.Sort;

public interface IGroupDao extends IDao {
	/**
	 * Gets products by group id
	 * @param groupId
	 * @return list of {@link Product}
	 */
	List<Product> getProducts(Integer groupId);
	
	/**
	 * Filters products by sporting of name and price fields' for defined group and page 
	 * @param groupId id of group
	 * @param limit count of records which will be selected
	 * @param offset index from that will be started to select entities
	 * @param sortByName sort ordering of name field
	 * @param sortByPrice sort ordering of price field
	 * @param lastSortColumnName serves for ordering of sort fields
	 * @return filtered list of {@link Product}
	 */
	List<Product> getProductsForPage(Integer groupId, Integer limit, Integer offset, Sort sortByName, Sort sortByPrice, String lastSortColumnName);
	
	/**
	 * Gets count of pages by id of group
	 * 
	 * @param groupId id of group
	 * @return session.setAttribute(Keys.PAGE_START_INDEX_OF_KEY, 1);
	 */
	int getCountOfProducts(Integer groupId);
	
	/**
	 * Returns all groups
	 * 
	 * @return list of {@link Group}
	 */
	List<Group> getAll();
	
	/**
	 * Puts new {@link Group}<br>
	 * A new index will be generated
	 * @param entity
	 * @return generated index
	 */
	Integer put(Group entity);
}
